﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BSChuangXu.Infrastructure.Interface
{
    /// <summary>
    /// 仓储接口
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBaseRepository<T> where T : class
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">添加信息</param>
        /// <returns></returns>
        public Task<int> Add(T entity);
        /// <summary>
        /// 添加（批量）
        /// </summary>
        /// <param name="entitys">添加信息</param>
        /// <returns></returns>
        public Task<int> AddRanges(List<T> entitys);
        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        public Task<IQueryable<T>> GetAll();
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">修改信息</param>
        /// <returns></returns>
        public Task<int> Update(T entity);
        /// <summary>
        /// 修改（批量）
        /// </summary>
        /// <param name="entitys">修改信息</param>
        /// <returns></returns>
        public Task<int> UpdateRanges(List<T> entitys);
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="entity">删除信息</param>
        /// <returns></returns>
        public Task<int> Delete(T entity);
        /// <summary>
        /// 删除（批量）
        /// </summary>
        /// <param name="entitys">删除信息</param>
        /// <returns></returns>
        public Task<int> DeleteRanges(List<T> entitys);
    }
}
